<?php  session_start();

/**
* @package		Parents@School
* @copyright	                Copyright (C) 2008 Kristof Beckers. All rights reserved.
* @Version		2.0
* @license		GNU/GPL, see LICENSE.php
**/
include ("../include/config.php");
require_once ("../include/db.php");
include ("../include/header.php");
if ($_SESSION['admin'] == "$adminid"){
	header("location:admin/index.php");
	}
$status = $_GET['status'];
$username1 = $_SESSION['myusername'];
$username = explode(".",$username1);
?>
<head>
<link href="http://fonts.googleapis.com/css?family=Source+Sans+Pro:200,300,400,600,700,900" rel="stylesheet" />
<link href="../templates/alicebourg/default.css" rel="stylesheet" type="text/css" media="all" />
<link href="../templates/alicebourg/fonts.css" rel="stylesheet" type="text/css" media="all" />
</head>

<body>
<div id="wrapper">
	<div id="header-wrapper">
    	<div id="header" class="container">
        	<div id="logo">
            <h1>Reservaties ouderavond Alicebourg</h1>
            </div>
        </div>
        <div id="menu" class="container">
        <?php include ("../include/menu.php"); ?>
       </div>

     </div>
     <div id="page" class="container">
     <div id="sidebar1">
     </div>
     <div id="content">

<?php
if ($status == "change")
{
	$sql="SELECT * FROM $tbusers WHERE username='$user'" ;
			$result = mysql_query($sql) or die (mysql_error());
					while ($row = mysql_fetch_array($result))
					{
					$username = $row['username'];
					$stamboeknr = $row['stamboeknr'];
					$straat = $row['straat'];
					$huisnr = $row['huisnr'];
					$postcode = $row['postcode'];
					$gemeente = $row['gemeente'];
					}
//Hier gaan we controleren op meerdere lln op het bovenstaande adres
			$sql1="SELECT * FROM $tbusers WHERE straat='$straat' AND huisnr='$huisnr' AND postcode='$postcode' AND gemeente='$gemeente'";
			$result1 = mysql_query($sql1) or die (mysql_error());
			
			// Tellen van het aantal rijen het resultaat weergeeft, indien gelijk dan of meer dan 2 gaan we de verschillende lln met hun klas weergeven.	
			$num_rows1 = mysql_num_rows($result1);
					if ($num_rows1 >= 2)
					{
						echo "<em>Selecteer uw zoon/dochter waarvoor u wil inloggen</em><br /><br /><br />";
					//resultaten weergeven
						while ($row1 = mysql_fetch_assoc($result1))
						{
							$usernametosplit = $row1['username'];
							$splitusername = explode(".",$usernametosplit);
							echo "<a href='".$workurl."index1.php?username1={$row1['username']}&klas={$row1['klas']}&status=1'/>".strtoupper($splitusername[1]). " " .strtoupper($splitusername[2])."</a> {$row1['klas']}<br /><br />";
						}
					}
					else
					{
						echo "Er is iets misgelopen, u wordt terug naar de beginpagina gebracht.";
						header("location:index.php");
					}
}
?>
</div>
</div>